<template>
	<view class="content">
		{{msg}}

	</view>
</template>

<script setup>
	import {ref} from 'vue'
	let msg=ref({})
	
	async function getnews()
	{
		let lst=await uni.$get('http://unidemo.dcloud.net.cn/api/news')
		console.log(lst)
		msg.value=lst
	}
	getnews()
	uni.request({
		url:'http://unidemo.dcloud.net.cn/api/news',
		success:(res)=>{
			console.log(res)
		}
	})
	</script>
	<!-- uni.request({
		url:request({
			url:'http://unodemo.dcloud.net.cn/api/news',
			success:(res)=>{
				console.log(res)
			}
		})
	})
	url:request({
			url:'http://unodemo.dcloud.net.cn/api/news',
			success:(res)=>{
				console.log(res)
			}
		})


	const requst = function(url, method = "GET", data) {
		return new Promise((resolve, reject) => {
			uni.requset({
				url,
				method,
				data,
				success: (res) => {
					resolve(res)
				},
				fail: (err) => {
					reject(err)
				}

			})
		})
	}
	async function getNews(){
	let lst = await requst('http://unodemo.dcloud.net.cn/api/news')
	console.log(lst)
	}
	getNews()
	
	
	async function getnews(){
		let lst=await uni.$get('http://unodemo.dcloud.net.cn/api/news')
		console.log(lst)
	}
getnews() -->
<style>

</style>